<?php 
$topCategories = $this->getTopCategorys();
?>

<li class="active category">
	<a href="<?php echo $this->getUrl('catalog/category/view/',array('id'=>12)) ?>">所有产品分类</a>
	<ul class="sub-category">
		<?php foreach($topCategories as $top):?>
		<?php $topCategory = Mage::getModel('catalog/category')->load($top->getId());?>
			<?php if($topCategory->hasChildren() && $topCategory->getIncludeInMenu()): ?>
				<?php if($topCategory->getId() != 6 && $topCategory->getId() != 8): ?>
				<li>
					<p class="sub-title">
						<span class="icon-pro icon-pro-1"></span>
						<a href="<?php echo $topCategory->getUrl() ?>" class=""><?php echo $topCategory->getName(); ?></a>
						<i class="icon-angle-right"></i>
					</p>
					<?php if($topCategory->hasChildren()):?>
					<p class="sub-cat">
						<?php $subCatagorys = $topCategory->getChildrenCategories();?>
						<?php $i=0; $num=2; foreach($subCatagorys as $third):?>
						<?php $thirdCategory = Mage::getModel('catalog/category')->load($third->getId());?>
							<?php if($i < $num): $i++;?>
							<a href="<?php echo $thirdCategory->getUrl(); ?>"><?php echo $thirdCategory->getName(); ?></a>
							<?php endif; ?>
						<?php endforeach;?>
					</p>
					<?php endif; ?>
					<ul class="sub-product">
						<?php foreach($subCatagorys as $lastSubcatagoey): ?>
						<li>
							<a href="<?php echo $lastSubcatagoey->getUrl() ?>" class="sub-product-title"><?php echo $lastSubcatagoey->getName() ?></a>

							<?php $lastCatagorysmall = $lastSubcatagoey->getChildrenCategories();?>
							<p class="sub-product-items">
								<?php foreach($lastCatagorysmall as $items): ?>
								<a href="<?php echo $items->getUrl()?>"><?php echo $items->getName() ?></a>&nbsp;|&nbsp;
								<?php endforeach; ?>
							</p>
						</li>
						<?php endforeach; ?>
					</ul>
				</li>
				<?php endif; ?>
			<?php endif; ?>
		<?php endforeach; ?>
		<!-- Jun Water & Drink -->
		<li>
			<p class="sub-title">
				<span class="icon-pro icon-pro-1"></span>
				<a href="<?php echo $this->getDrinkcata()->getUrl() ?>" class=""><?php echo $this->getDrinkcata()->getName() ?> &nbsp;/</a>
				<a href="<?php echo $this->getWatercata()->getUrl() ?>" class=""><?php echo $this->getWatercata()->getName() ?></a>
				<i class="icon-angle-right"></i>
			</p>
			<p class="sub-cat">
				<a href="<?php echo $this->getDrinkcata()->getUrl() ?>"><?php echo $this->getDrinkcata()->getName() ?></a>
				<a href="<?php echo $this->getWatercata()->getUrl() ?>"><?php echo $this->getWatercata()->getName() ?></a>
			</p>
			<ul class="sub-product">
				<li>
					<a href="<?php echo $this->getDrinkcata()->getUrl() ?>" class="sub-product-title"><?php echo $this->getDrinkcata()->getName() ?></a>
					<p class="sub-product-items">
						<?php foreach($this->getDrinkcata()->getChildrenCategories() as $items): ?>
							<a href="<?php echo $items->getUrl() ?>"><?php echo $items->getName() ?></a>&nbsp;|&nbsp;
						<?php endforeach; ?>
					</p>
				</li>

				<li>
					<a href="<?php echo $this->getWatercata()->getUrl() ?>" class="sub-product-title"><?php echo $this->getWatercata()->getName() ?></a>
					<p class="sub-product-items">
						<?php foreach($this->getWatercata()->getChildrenCategories() as $items): ?>
							<a href="<?php echo $items->getUrl() ?>"><?php echo $items->getName() ?></a>&nbsp;|&nbsp;
						<?php endforeach; ?>
					</p>
				</li>
			</ul>
		</li>
	</ul>
</li>

